<template>
  <div class="dashboard-container">
    <div>
      <pie-chart v-bind:saledata="saleResult"></pie-chart>
      <bar-chart v-bind:saledata="saleResult"></bar-chart> 
    </div>
  </div>
</template>

<script>
import {getSaleResult} from "@/api/saleResult"
import barChart from "./barChart.vue";
import pieChart from "./pieChart.vue"

export default {
  name: "Dashboard",
  components: {
    barChart,
    pieChart
  },
  computed: {},
  data() {
    return {
      saleResult: null,
    };
  },
  created(){
    this.fetchData()
  },
  methods: {
    fetchData() {
      getSaleResult().then(response => {
        this.saleResult = response.data
      })
    }
  },
};
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
  #chartFirst {
    width: 300px;
    height: 400px;
    
  }
}
</style>
